var express = require("express");
const jwt = require('jsonwebtoken');
var router = express.Router();

//二级路由
router.post('/token',async function(req,res){
    // //解密 会把token生成时传入的用户信息解密出来
    const token = req.get('Authorization').split(' ')[1];
    const user = jwt.verify(token, 'user');
    res.send({
        message: "获取用户信息成功",
        code: 200,
        userinfo:user
    });
});

module.exports = router;